﻿using DocumentFormat.OpenXml.Lite.Xml;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Schema;
using System.Xml.Serialization;

namespace DocumentFormat.OpenXml.Lite.WordprocessingML.Drawing
{
    [XmlRoot("anchor", Namespace = Constants.Drawing)]
    public class DrawingAnchor : XmlSerializable
    {
        #region Attributes

        [Optional]
        [XmlAttribute("distT", Form = XmlSchemaForm.Qualified)]
        public Nullable<uint> DistanceOnTop { get; set; }

        [Optional]
        [XmlAttribute("distB", Form = XmlSchemaForm.Qualified)]
        public Nullable<uint> DistanceOnBottom { get; set; }

        [Optional]
        [XmlAttribute("distL", Form = XmlSchemaForm.Qualified)]
        public Nullable<uint> DistanceOnLeft { get; set; }

        [Optional]
        [XmlAttribute("distR", Form = XmlSchemaForm.Qualified)]
        public Nullable<uint> DistanceOnRight { get; set; }

        [Optional]
        [XmlAttribute("simplePos", Form = XmlSchemaForm.Qualified)]
        public Nullable<bool> SimplePosition { get; set; }

        [XmlAttribute("relativeHeight", Form = XmlSchemaForm.Qualified)]
        public uint RelativeHeight { get; set; }

        [XmlAttribute("behindDoc", Form = XmlSchemaForm.Qualified)]
        public bool BehindDocument { get; set; }

        [XmlAttribute("locked", Form = XmlSchemaForm.Qualified)]
        public bool Locked { get; set; }

        [XmlAttribute("layoutInCell", Form = XmlSchemaForm.Qualified)]
        public bool LayoutInCell { get; set; }

        [Optional]
        [XmlAttribute("hidden", Form = XmlSchemaForm.Qualified)]
        public Nullable<bool> Hidden { get; set; }

        [XmlAttribute("allowOverlap", Form = XmlSchemaForm.Qualified)]
        public bool AllowOverlap { get; set; }

        #endregion

        #region Elements

        [XmlElement("simplePos", Namespace = Constants.Drawing)]
        public SimplePosition Position { get; set; }

        [XmlElement("positionH", Namespace = Constants.Drawing)]
        public HorizontalPositioning HorizontalPositioning { get; set; }

        [XmlElement("positionV", Namespace = Constants.Drawing)]
        public VerticalPositioning VerticalPosition { get; set; }

        [XmlElement("extent", Namespace = Constants.Drawing)]
        public Extent Extents { get; set; }

        [Optional]
        [XmlElement("effectExtent", Namespace = Constants.Drawing)]
        public EffectExtent EffectExtents { get; set; }

        [XmlElement("", Namespace = Constants.Drawing)]
        public IWrapType WrapType { get; set; }

        [XmlElement("docPr", Namespace = Constants.Drawing)]
        public DrawingObjectProperties Properties { get; set; }

        [XmlElement("cNvGraphicFramePr", Namespace = Constants.Drawing)]
        public GraphicFrameProperties GraphicProperties { get; set; }

        [XmlElement("graphic", Namespace = Constants.Graphic)]
        public Graphic Graphic { get; set; }

        #endregion

        public DrawingAnchor() { }
    }
}
